package com.societyGames.faceExercises
{
	import com.greensock.TweenNano;
	import com.societyGames.action.Action;
	
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	
	public class SelectFaceAction extends Action
	{
		private var _displayObject:DisplayObject;
		private var _desiredX:Number;
		private var _duration:Number; 
		
		public function SelectFaceAction(displayObject:DisplayObject, desiredX:Number, duration:Number)
		{
			this._displayObject = displayObject;
			this._desiredX = desiredX;
			this._duration = duration;
		}
		
		public override function startAction():void
		{	
			TweenNano.to(this._displayObject, _duration, {x:this._desiredX, onComplete:onComplete});	
		}
		
		private function onComplete():void
		{
			this._completeEventObject.dispatchEvent();
		}
	}
}